package com.ygqh.baby.po;

import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.ygqh.baby.ao.DataStatus;
import com.ygqh.baby.utils.ASEUtils;

public class YgUserIdentity {

	private final static String SECRET_KEY = "32CCB3AE-45D6-44D9-B6C0-AF37AF9014C6";

	private Long id;

	private Long userId;

	private String idNo;

	private String name;

	private Date createTime;

	private DataStatus status;

	public static String decryptIdNo(String idNo) {
		if (StringUtils.isNotBlank(idNo)) {
			return ASEUtils.decrypt(idNo, SECRET_KEY);
		}
		return idNo;
	}

	public static String encryptIdNo(String idNo) {
		if (StringUtils.isNotBlank(idNo)) {
			return ASEUtils.encrypt(idNo, SECRET_KEY);
		}
		return idNo;
	}

	public static String idNoAddStar(String idNo) {
		if (StringUtils.isNotBlank(idNo)) {
			return idNo.replaceAll("(\\d{4}).*(\\w{4})", "$1******$2");
		}
		return idNo;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getIdNo() {
		return idNo;
	}

	public void setIdNo(String idNo) {
		this.idNo = idNo == null ? null : idNo.trim();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name == null ? null : name.trim();
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public DataStatus getStatus() {
		return status;
	}

	public void setStatus(DataStatus status) {
		this.status = status;
	}

}